#include "read_boy_confg.h"
#include "read_boy_test.h"
#include "read_boy.h"
#include "read_boy_book.h"

extern const uint16_t c_bmpshanshui03RGB565[150*150];

//#include "read_boy_base.h"

//#include "readboy_epd_4_2B.h"
void my_drv_base_init();

uint8_t read_one_byte_read_boy_fb(uint32_t num);
void test_fb();

//uint8_t my_imge[92*81]; c_bmpshanshui02GRAY8
int16_t my_imge[150*2];

void read_boy_test_main(){
    //EPD_GPIOInit();	
    readboyEpdBase_GPIOInit();
    //my_readboyEpdBase_init();
    
    
    
    my_drv_base_init();
    
    my_read_boy_book_init();
    my_drv_base.drv_setDepth(1);
    
    my_drv_base.drv_fullpart(0);
    
    
    test_fb();
    
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    
    DelayMs(2000);	
    
    
    my_drv_base.drv_fullpart(0);
    read_boy_fb_clear();
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    
    
    

     
    read_boy_book_task();
    
    //my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);          
     DelayMs(15000);
    
    //4.2b
    if(read_boy_type == READ_BOY_EPD_4_2B){
#if defined(READ_BOY_DEV_4_2B)     
    my_drv_base.drv_setDepth(15);
        //read_boy_fb_clear();
        read_boy_fb_fillRect(0,0,400,300);
        my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
     DelayMs(1000);	 
    my_drv_base.drv_setDepth(15);
        read_boy_fb_clear();
        //read_boy_fb_fillRect(0,0,400,300);
     my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
     DelayMs(1000);	      
#endif   
    }        
//    my_drv_base.drv_fullpart(1);
//    for(int i = 1; i < 16;i++){
//        
//        my_drv_base.drv_setDepth(i);
//        //read_boy_fb_clear();
//        read_boy_fb_fillRect(10,10*i,20,10);
//        read_boy_draw_str_en(40,10*i,read_boy_FONT_6x8,"arm-2d");
//        my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
//        //DelayMs(500);	
//    }
    my_drv_base.drv_fullpart(1);
     my_drv_base.drv_setDepth(15);
     
     //read_boy_draw_char_CN_24(10,10 ,"我");
     //my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);          
     //DelayMs(5000);
    //uint8_t my_imge[92*81]; 
//    for(int i = 0; i < 20; i++){
//        read_boy_fb_draw_A8_bitmap(10,10,92,81,*gif[i]);
//        
//        //read_boy_Floyd_Steinberg_baier( my_imge,*gif[i],92,81);
//        read_boy_Floyd_Steinberg_baier_to_fb(10,105,92,81,*gif[i]);
//        //read_boy_fb_draw_A8_bitmap(10,105,92,81,my_imge);
//        
//        //read_boy_Floyd_Steinberg_image( my_imge,*gif[i],92,81);
//        //read_boy_fb_draw_A8_bitmap(105,105,92,81,my_imge);
//        read_boy_Floyd_Steinberg_to_fb(105,105,92,81,my_imge,*gif[i]);
//        my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);  
//        //DelayMs(2000);
//    
//    }

    //read_boy_Floyd_Steinberg_baier_to_fb(10,10,150,150,c_bmpshanshui02GRAY8);
    
    //read_boy_Floyd_Steinberg_to_fb(10,10,150,150,my_imge,c_bmpshanshui01GRAY8);
    //extern const uint16_t c_bmpwly11RGB565[300*440];
    
    //read_boy_Floyd_Steinberg_to_fb_rgb565( 0, 0,300,440,my_imge,c_bmpwly11RGB565);
    //read_boy_Floyd_Steinberg_baier_to_fb_rgb565(0,0,300,440,c_bmpwly11RGB565);
    //read_boy_fb_draw_rgb565_bitmap(10,10,150,150,c_bmpshanshui03RGB565);
    
    //read_boy_Floyd_Steinberg_baier( my_imge,c_bmpshanshui02GRAY8,150,150);
    //read_boy_Floyd_Steinberg_image( my_imge,c_bmpshanshui02GRAY8,150,150);
        //read_boy_fb_draw_A8_bitmap(10,10,150,150,my_imge);
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);          
    
    DelayMs(5000);

    my_drv_base.drv_fullpart(0);
    read_boy_fb_clear();
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    DelayMs(400);
    //4.2b
    if(read_boy_type == READ_BOY_EPD_4_2B){
#if defined(READ_BOY_DEV_4_2B)     
    read_boy_fb_fillRect(0,0,400,300);
        my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    DelayMs(400);
    read_boy_fb_clear();
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    DelayMs(400);
#endif  
    }        
    my_drv_base.drv_fullpart(1);
    my_drv_base.drv_setDepth(15);
    read_boy_fb_clear();
    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
    
//    my_drv_base.drv_sleep();
//    
//    my_drv_base.drv_setDepth(15);
//    
//    my_drv_base.drv_fullpart(0);
//    read_boy_fb_clear();
//    my_drv_base.drv_dispWriter(&read_boy_fb_read_one_byte,my_drv_base._quality);
//    
//    DelayMs(2000);
    //drvSSD168x_drv_dispWriter(&read_one_byte_read_boy_fb,1);
    //drvSSD168x_drv_draw16grey_step(&read_one_byte_read_boy_fb,1);
}











